// TOWN SCRIPT
//    Town 28: Padan

// This is the special encounter script for this town.
// The states INIT_STATE, EXIT_STATE, and START_STATE have
// meanings that are described in the documenation. States you write
// yourself should be numbered from 10-100.

begintownscript;

variables;

short i,j,k,r1,choice;

body;

beginstate INIT_STATE;
// This state called whenever this town is entered.
	enable_add_chars(1);
	set_name(6,"Ghazal");
	set_name(7,"Dasmaf");
	set_name(8,"Ephon");
	set_name(9,"Yenbor");
	set_name(10,"Wasali");
	set_state_continue(16);	
break;

beginstate EXIT_STATE;
// Always called when the town is left.
break;

beginstate START_STATE;
// This state is called every turn the party is in this town.
break;

beginstate 10;
	if (character_in_party(2802) > 3)
		set_state_continue(11);
	set_state_continue(12);
break;

beginstate 11;
	message_dialog("_Let's be off then. The ferry's a ways up north._","");
break;

beginstate 12;
	reset_dialog();
	add_dialog_str(0,"_It would be a great help as well, I must say._",0);
	add_dialog_str(1,"Do you accept his offer to travel with you?",0);
	add_dialog_choice(0,"Accept.");
	add_dialog_choice(1,"Refuse.");
	choice = run_dialog(1);
	if (choice == 1)
		set_state_continue(13);
	if (choice == 2)
		end();
break;

beginstate 13;
	message_dialog("_Let's be off then. The ferry to the isles is north of the Midland River, which means we'll have go around west._","");
	set_state_continue(15);
break;

beginstate 15;
	set_flag(97,0,1);
		message_dialog("[An NPC has joined you.]","");
		add_char_to_party(8);
	set_state_continue(18);
break;

beginstate 16;
	if (get_flag(97,0) >= 1)
		set_state_continue(17);
	set_state_continue(19);
break;

beginstate 17;
	if (character_in_party(2802) >= 0) 
		erase_char(8);		
break;

beginstate 18;
// OBSOLETE NODE: Timers are no longer used. Manually write scenario timers in the 
// scenario script.
//6,000 moves till scenario state 21
break;

beginstate 19;
	if (get_flag(196,0) == 250)
		end();
	reset_dialog();
	add_dialog_str(0,"A farming town on the outskirts of Seawyrm domain, Padan has a fair mix of cultures who seem to coexist without tension. Long, roughly-built buildings stretch over the terrain, and townspeople tend to crops for harvest.",0);
	add_dialog_choice(0,"OK.");
	choice = run_dialog(1);
	set_flag(196,0,250);
break;

